<?php
 $pdo = new PDO("mysql:host=localhost;dbname=hospital","root","tailiyan88"); 
 
$json_string = file_get_contents("a.json");
    
$obj=json_decode($json_string,true);
echo "<table>";
foreach($obj as $v)
{
	
	$key=$v['key'];
	$province=$v['label'];
	if(!empty($v["children"])&& is_array($v["children"]))
	{
		
		foreach($v["children"] as $c)
		{
			//
			if(!empty($c["children"])&& is_array($c["children"]))
	        {
						foreach($c["children"] as $s)
						{
							echo "<tr><td>".$province."</td><td>".$c['label']."</td><td>".$s['label']."</td><td>".$s['key']."</td></tr>";
						//$pdo->exec("insert into diqu(`p`,`c`,`a`,`code`) values('$province','".$c['label']."','".$s['label']."','".$s['key']."')");
						}
			}else
			{
				echo "<tr><td>".$province."</td><td>".$c['label']."</td><td>"." "."</td><td>".$c['key']."</td></tr>";
				//$pdo->exec("insert into diqu(`p`,`c`,`a`,`code`) values('$province','".$c['label']."','','".$c['key']."')");
			}
			
		}
	}

}
echo "</table>";